package com.suxin.jvm.jmx;

import javax.management.MBeanServer;
import javax.management.ObjectName;
import java.lang.management.ManagementFactory;
import java.util.concurrent.TimeUnit;

/**
 * @author Tang
 * @classname JVMInfoMain
 * @description [  ]
 * @date 2022/5/9 15:48
 */
public class JMBMain {

    public static void main(String[] args) throws Exception {

        MBeanServer beanServer = ManagementFactory.getPlatformMBeanServer();

        Hello hello = new Hello();
        Class<Hello> helloClass = Hello.class;
        beanServer.registerMBean(hello, new ObjectName(helloClass.getPackage().getName() + ":" + "type=" + helloClass.getName()));

        TimeUnit.SECONDS.sleep(Integer.MAX_VALUE);
    }

}